<?php
    require_once('../includes/DbConnector.php');
    if(isset($_GET['action']) && !empty($_GET['action'])) {
        // INPUT DATA.
        $action = $_GET['action'];
        $connector  = new DbConnector();
        $sql = "select
                b.place,
                count(*) AS no_of_bars
                from bar b
                group by b.place";
        $result = $connector->query($sql);
        
        $a=array();
        while($row = mysql_fetch_array($result)){
            array_push($a,$row);
        }
        echo json_encode($a);
    }
?>